#include<stdio.h>
#include<stdlib.h>
#include<math.h>

#include"permut.h"

#ifndef _HOPNET_H_
#define _HOPNET_H_

#define RANDOM_INIT() rand()
#define RANDOM(a) (int)((double)rand()/(RAND_MAX+1)*a)

class THopNet {
private:
    int n;
    int w;
    int l;
    float *Y;
    float **W;
    float **L;
    int d;
    float eta;
    TPermut* Permut;
public:
    THopNet(int New_n = 1, int New_d = 1, float New_eta = 0.7);
    ~THopNet(void);
    int Setd(int New_d);
    float Seteta(float New_eta);
    int Getn(void);
    int Getw(void);
    int Getl(void);
    float* GetY(void);
    float** GetW(void);
    float** GetL(void);
    int Getd(void);
    float Geteta(void);
    int ClearY(void);
    int ClearW(void);
    int ClearL(void);
    int NegationY(void);
    int LtoY(int pos);
    int RandY(int per);
    int RandW(void);
    int RandL(void);
    int RandAllMatrix(void);
    int ReCreate(int New_n);
    int AddL(void);
    int DelL(int dk = 1);
    int PrintY(FILE* stream);
    int PrintW(FILE* stream);
    int PrintL(FILE* stream);
    int PrintAllMatrix(FILE* stream);
    int ScanAllMatrix(FILE* stream);
    float f(float arg, int dl);
    float MSE(float* Y, float* nY);
    float E(void);
    float CompNeuron(int pos);
    float MSECompNeuron(int pos);
    float CompNeuron(float* pY, float** pW);
    float MSECompNeuron(float* pY, float** pW);
    int CompS();
    float MSECompS();    
    int CompA();
    float MSECompA();
    int CompR();
    float MSECompR();
    int CompMSES(void);
    int CompMSEA(void);
    int CompMSER(void);
    int LearnH(void);
    float LearnD(void);
    int LearnDMSE(float MSEmin);
    float LearnMPR(void);
    int LearnMPRMSE(float MSEmin);
	float LearnP(void);
	int LearnPMSE(float MSEmin);
	float LearnS(void);
	int LearnSMSE(float MSEmin);
};
#endif
